<template>
  <div></div>
</template>

<script setup>
import { inject ,onMounted,ref,onBeforeUnmount} from "vue";
let map=ref(null)
let rpid=ref(null)
onMounted(()=>{
  map.value = inject('mapScene').map;
  map.value.setZoom(1)
  rotate()
})
function rotate() {
let center = map.value.getCenter()
center.lng += 0.1
map.value.setCenter(center);
rpid.value=requestAnimationFrame(rotate)
}
// 点击zoom控件停止旋转
let zoom =document.querySelector('.l7-control-zoom')
zoom.onclick=function(){
cancelAnimationFrame(rpid.value)
}
onBeforeUnmount(()=>{
cancelAnimationFrame(rpid.value)
})
</script>

<style scoped lang="scss">
</style>
